<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/vue.js"></script>
</head>
<body>
<div id="app">
    <ul>
        <li v-for="(hero,index) in heros" :key="index">
            {{hero.ame}},{{hero.csore}}
            <button @click="del(index)">删除</button>
        </li>
    </ul>
    姓名： <input type="text" v-model="xing"><br>
    成绩： <input type="text" v-model="cheng">
    <button @click="addHero">添加英雄</button>
</div>
<script>
    new Vue({
      el:"#app",
      data(){
        return{
          heros:[{
            id:1,
            ame:"阿里安娜",
            csore:"A"
          },{
            id:2,
            ame:"阿里",
            csore:"B"
          },{
            id:3,
            ame:"腾讯",
            csore:"C"
          },{
            id:4,
            ame:"小米",
            csore:"D"
          }],
          xing:"",
          cheng:"",
        }
      },
      methods:{
        addHero(){
          this.heros.push(
              {
                ame:this.xing,
                csore:this.cheng
              }
          )
        },
        del(index){
          this.heros.splice(index,1)
        }
      }
    })
</script>
</body>
</html>